package cn.livingCloud.dto;

import cn.livingCloud.entity.core.CaseRecordType;
import cn.livingCloud.utils.GroupHelper;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by 唐旭 on 2016/6/7.
 */
public class CaseAssignmentFormDto extends CaseOperatorForm {
    private String deptUuid;
    private String employeeUuid;
    private DeptDto currentDept;
    private List<DeptDto> deptList = new ArrayList<>();
    private List<EmployeeDto> employeeList = new ArrayList<>();

    public CaseAssignmentFormDto() {
        recordType = CaseRecordType.ASSIGNMENT;
    }

    public CaseAssignmentFormDto(String caseUuid, String deptUuid) {
        super();
        this.caseUuid = caseUuid;
        this.deptUuid = deptUuid;
        recordType = CaseRecordType.ASSIGNMENT;
    }

    public List<DeptDto> getDeptList() {
        return deptList;
    }

    public CaseAssignmentFormDto setDeptList(List<DeptDto> deptList) {
        this.deptList = deptList;
        return this;
    }

    public String getDeptUuid() {
        return deptUuid;
    }

    public CaseAssignmentFormDto setDeptUuid(String deptUuid) {
        this.deptUuid = deptUuid;
        return this;
    }

    public List<EmployeeDto> getEmployeeList() {
        return employeeList;
    }

    public CaseAssignmentFormDto setEmployeeList(List<EmployeeDto> employeeList) {
        this.employeeList = employeeList;
        return this;
    }

    public DeptDto getCurrentDept() {
        return currentDept;
    }

    public CaseAssignmentFormDto setCurrentDept(DeptDto currentDept) {
        this.currentDept = currentDept;
        return this;
    }

    public String getEmployeeUuid() {
        return employeeUuid;
    }

    public CaseAssignmentFormDto setEmployeeUuid(String employeeUuid) {
        this.employeeUuid = employeeUuid;
        return this;
    }

    /**
     * 对部门进行分组显示
     */
    public Map<Object, List> getGroupDepts() {
        List<GroupHelper.GroupKey> groupKeyList = new ArrayList<>(deptList.size());
        for (DeptDto deptDto : deptList) {
            groupKeyList.add(deptDto);
        }
        return GroupHelper.groupByKey(groupKeyList);
    }
}
